<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <title>文章修改页面</title>
    <link rel="stylesheet" href="/layui/plugins/layui/css/layui.css" media="all" />
    <script src="/layui/plugins/layui/layui.js"></script>
    <script src="/main/js/jquery.min.js"></script>
    <script src="/main/js/template-web.js"></script>
    <style>
        body{margin: 10px;}
        .demo-carousel{height: 200px; line-height: 200px; text-align: center;}
    </style>
</head>
<body>

    <input id="userName" name="userName" type="hidden" th:value="${session.user}"/>
    <input id="url" name="url" type="hidden" th:value="${url}"/>
    <input id="count" name="count" type="hidden" />
    <input id="pageNum" name="pageNum" type="hidden" />
<div style="margin: 15px;">
    <fieldset class="layui-elem-field">
        <legend>文章主题修改页面 </legend>
        <form class="layui-form" action="">
            <label class="layui-form-label">文章主题:</label>
            <script type="text/html" id="theme1">
                <div class="layui-input-block">
                    <select name="theme" lay-filter="aihao" >
                        <option value=""></option>
                        {{each list value i}}
                        <option >{{value.title}}</option>
                        {{/each}}
                    </select>
                </div>
            </script>

            <script type="text/javascript">
                var theme1 ='';
                $(document).ready(function () {
                    url = '/column/findAllColumn/1';
                    $.ajax( {
                        type : "post",
                        dataType:"json",
                        url : url,
                        timeout : 20000,
                        cache : false,
                        success : function(data) {
//                alert(JSON.stringify(data.column[0]));
                            theme1 = template('theme1', data);
                            document.getElementById('content').innerHTML = theme1;
                        }
                    });
                })
            </script>
            <div id="content"></div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit=""  lay-filter="formDemo">立即提交</button>
                </div>
            </div>
        </form>
    </fieldset>
</div>

<script>
    layui.use(['laypage', 'layer', 'table','form', 'element'], function(){

          layer = layui.layer;//弹层
          table = layui.table; //表格
            element = layui.element;
          var form = layui.form;
            var urlId = parent.id;
            form.on('submit(formDemo)',function (data) {
                var newTag = data.field;

                $.ajax({
                    url:'/column/updateColumnName/'+urlId,    //请求的url地址
                    data:data.field,
                    dataType:"json",   //返回格式为json
                    type:"GET",   //请求方式
                    success:function (data) {
                        if( data  == 1){
                            layer.alert("提交成功")
                        }
                        else layer.alert("提交失败")

                    }
                });
            })

    });

</script>

</body>
</html>